package com.chinacoal.microservice.api;

import java.util.List;

import javax.validation.Valid;

import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import com.baomidou.mybatisplus.plugins.Page;
import com.chinacoal.microservice.api.fallback.TaskCatRegisterClientFallback;
import com.chinacoal.microservice.api.model.QueryUtaskCatParam;
import com.chinacoal.microservice.api.model.entity.UtaskCatEntity;
import com.chinacoal.microservice.model.common.Entity.InsertValid;
import com.chinacoal.microservice.model.common.Entity.UpdateValid;
import com.chinacoal.microservice.util.result.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * @Description: 待办类型管理接口
 * @author linp
 * @date 2019年11月29日 下午7:21:25
 * @version V1.0
 */
@Api(tags = {"待办类型管理接口"})
@FeignClient(name = "ccms-union-task", configuration = FeignAutoConfiguration.class, fallback = TaskCatRegisterClientFallback.class)
public interface TaskCatRegisterClient {

    @ApiOperation(value = "新增待办类型")
    @PostMapping("/uniontask/cat/add")
    public Result<Object> addTaskReg(@Validated({InsertValid.class}) @RequestBody UtaskCatEntity utaskCatEntity);
	
    @ApiOperation(value = "修改待办类型")
    @PutMapping("/uniontask/cat/updateTaskReg")
    public Result<Object> updateTaskReg(@Validated({UpdateValid.class}) @RequestBody UtaskCatEntity utaskCatEntity);
    
    @ApiOperation(value = "删除待办类型")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="path", name = "catId", value = "主键id", required = true, dataType = "String")
    })
    @DeleteMapping("/uniontask/cat/deleteTaskReg/{catId}")
    public Result<Object> deleteTaskReg(@PathVariable("catId") String catId);
    
    @ApiOperation(value = "查询待办类型列表")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType="path", name = "page", value = "当前页码", required = true, dataType = "int"),
        @ApiImplicitParam(paramType="path", name = "pageSize", value = "每页记录数", required = true, dataType = "int")
    })
    @PostMapping("/uniontask/cat/getList/{page}/{pageSize}")
    public Result<Page<UtaskCatEntity>> getList(@PathVariable("page") Integer page,
										  		@PathVariable("pageSize") Integer pageSize,
										  		@Valid @RequestBody QueryUtaskCatParam param);
    
    @ApiOperation(value = "查询待办类型详情（按主键id）")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="path", name = "catId", value = "主键id", required = true, dataType = "String")
    })
    @GetMapping("/uniontask/cat/getTaskCat/{catId}")
	public Result<UtaskCatEntity> getTaskCat(@PathVariable("catId") String catId);
	
    @ApiOperation(value = "根据应用查询待办类型")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="path", name = "sysId", value = "应用Id", required = true, dataType = "String")
    })
    @GetMapping("/uniontask/cat/getTaskCatBySysId/{sysId}")
	public Result<List<UtaskCatEntity>> getTaskCatBySysId(@PathVariable("sysId") String sysId);
    
    @ApiOperation(value = "根据上级待办类型查询下级待办类型")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="path", name = "upCatId", value = "上级类型Id", required = true, dataType = "String")
    })
    @GetMapping("/uniontask/cat/getLowerTaskCat/{upCatId}")
	public Result<List<UtaskCatEntity>> getLowerTaskCat(@PathVariable("upCatId") String upCatId);
}
